package com.hy.erp.inventory.service;

import java.util.List ;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

/*import javax.ejb.Stateless ;

import org.jboss.seam.ScopeType ;
import org.jboss.seam.annotations.Name ;
import org.jboss.seam.annotations.Scope ;
import org.jboss.seam.async.Schedule ;
*/
import com.hy.enterprise.architecture.foundation.ArchitectureFoundationException;
import com.hy.enterprise.framework.service.business.AbstractBusinessService;
import com.hy.erp.inventory.dao.PutDepotTypeDao;
import com.hy.erp.inventory.dao.interfaces.IPutDepotTypeDao;
import com.hy.erp.inventory.dao.interfaces.IUserDao;
import com.hy.erp.inventory.pojo.PutDepotType;
import com.hy.erp.inventory.pojo.interfaces.IPutDepotType;
import com.hy.erp.inventory.pojo.interfaces.IUser;
import com.hy.erp.inventory.service.interfaces.IPutDepotTypeService;
/**
 * 
 * <ul>
 * <li>开发作者：汤莉</li>
 * <li>设计日期：2010-10-13；时间：上午10:40:40</li>
 * <li>类型名称：PutDepotTypeService</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
/*@Name("putDepotTypeService")
@ Scope ( ScopeType.STATELESS )
@ Stateless
*/
@Component("putDepotTypeService")
public class PutDepotTypeService
								extends
								AbstractBusinessService < PutDepotTypeDao >
																		implements
																		IPutDepotTypeService
{

	/**
	 * <ul>
	 * <li>开发作者：汤莉</li>
	 * <li>设计日期：2010-10-13；时间：上午10:41:03</li>
	 * <li>字段类型：long；字段名称：serialVersionUID</li>
	 * <li>设计目的：</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 */
	private static final long	serialVersionUID	=
														- 4148865682432628606L ;
	
	private IPutDepotTypeDao putDepotTypeDao=null;
	
	

	@Resource(name="putDepotTypeDao")
	public void setPositionTypeDao(IPutDepotTypeDao putDepotTypeDao) {
		this.putDepotTypeDao = putDepotTypeDao;
	}
	/**
	 * 
	 * 构造函数
	 */
	public PutDepotTypeService()
	{
		super ( );
	}
	
	@ Override
	public boolean addPutDepotType (
										PutDepotType putDepotType )
	{
		if(putDepotType==null)
		{
			return true;
		}
		else
		{
			//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
			//IPutDepotType iPutDepotType= putDepotType;
			return putDepotTypeDao.persist ( putDepotType ) ;
		}
	}

	@ Override
	public Integer removePutDepotType (
										String [ ] typeIds )
	{
		if ( ( null == typeIds )
			     || ( typeIds.length == 0 ) )
			{
				return new Integer (
				                     0 ) ;
			}
			else
			{
				//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
				return putDepotTypeDao.remove ( typeIds );
			}
	}

	@ SuppressWarnings ( "unused" )
	@ Override
	public boolean modifyPutDepotType (
										PutDepotType putDepotType )
	{
		if ( ( null == putDepotType ) || ( null == putDepotType.getIdentifier ( ) ))
		{
			return true;
		}
		else
		{
			//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
			//IPutDepotType iPutDepotType= putDepotType;
			
			if ( null == putDepotType )
			{
				throw new ArchitectureFoundationException (
				                                            "修改用户实体数据时发生错误，所需要修改的实体在数据库中并不存在" ) ;
			}
			return (putDepotTypeDao.merge ( putDepotType )!=null) ;
		}
		
	}

	@ Override
	public String [ ] addPutDepotType (
										Object [ ] objects )
	{
		//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
		PutDepotType[] types=new PutDepotType[objects.length];
		for ( int i =
						0 ; i < objects.length ; i ++ )
		{
			PutDepotType type=( PutDepotType ) objects[i];
			types[i]=type;
		}
		return putDepotTypeDao.persist ( types ) ;
	}

	@ Override
	public List < PutDepotType > getAllPutDepotType ( )
	{
		//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
		return putDepotTypeDao.find ( ) ;
	}

	@ Override
	public String [ ] modifyPutDepotType (
											Object [ ] objects )
	{
		if (  null == objects ) 
		{
			return null;
		}
		else
		{
			//IPutDepotTypeDao dao=( IPutDepotTypeDao ) this.getDao ( IPutDepotType.class );
			PutDepotType[] types=new PutDepotType[objects.length];
            for(int i=0;i<objects.length;i++)
            {
            	PutDepotType type=( PutDepotType ) objects[i];
            	types[i]=type;
            }
			
			return putDepotTypeDao.merge ( types );
		}
	}

}
